﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

namespace ControlTask2
{
    class TextInput
    {
        private string path = @"G:\Леся\Репозиторий\Inteducation2\LesyaSmagliy\ControlTask2\List.txt";

        public TextInput()
        {
            if (!File.Exists(path))
                File.Create(path).Dispose();
        }

        public void WriteToFile()
        {
            Console.WriteLine("Enter text:");
            string str = Console.ReadLine();
            File.AppendAllText(path, str);
            Console.WriteLine();  //WriteAllText
        }

        public void WordCalculator()
        {
            string str = File.ReadAllText(path);
            string [] strArr = str.Split(' ');
            Console.WriteLine("Word count: {0}", strArr.Length);
        }

    }
}
